Release 10.1A: OpenEdge Development:
Progress Dynamics Advanced Development
Refreshing the database query
One of the most important things to keep in mind when using SDOs is that they always operate on a temp-table that is a snapshot of the database at the time the temp-table was built. This represents a compromise of some of the immediacy that older Progress applications could take advantage of. In an older host-based or client/server application, you always knew that the database record you were looking at was one you were actually positioned to, and that you could lock a record while you worked on it. The realities of distributed applications require us to design record processing in which the client is not so tightly coupled to the database.
If you want to be able to run your application in a distributed environment, with databases on numerous machines in different locations, your client objects cannot sit on the actual database record, which is in a database they are not even connected to.
Therefore, you sometimes need to refresh the
RowObjectquery your client objects are looking at. For example, a part of the application might be using a row when another part of your application signals that a row has been modified. One way to do this is simply to invoke theopenQueryfunction. This reopens the database query and reloads theRowObjecttemp-table. If you wish, you can save off theRowIdentof the row your client is currently positioned to and reposition to that record after the query is reopened, using code similar to that in our mark and return example above.If you simply want to refresh the row your client is currently looking at, you can refer to the third example in the sample reposition window. The Modify Row and Refresh Row buttons modify and then refresh a database record. The code under the Modify Row button simulates the situation of having a database record changed by another user while you are looking at it. It retrieves the current
Customerrecord and changes the name, as shown:
Note: Keep in mind that this is just a test procedure. In a real application window you would not do a database retrieval like this directly.
You do not see this change because it does not immediately affect your
RowObjectdataset. If you want to confirm that you are looking at the latest values for a record, you can select the Refresh Row button. This runs the refreshRow procedure, which re-reads the currentRowObjectrow out of the database and writes its current field values into theRowObjecttable, as shown:
It also publishes the
dataAvailableevent, so that your viewer requests those fresh values and redisplays them. Select the dataAvailable button to see the“MOD!”to theCustomerrecord, as shown:
![]()
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |